import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';

import { getDictTypeListApi } from '/@/api/admin/dict';
import { DICT } from '/@/enums/dict';

export const columns: BasicColumn[] = [
  {
    title: '岗位名称',
    dataIndex: 'postName',
    // width: 200,
  },
  {
    title: '组织部门',
    dataIndex: 'deptName',
    // width: 200,
  },

  {
    title: '岗位成员',
    dataIndex: 'names',
    // width: 250,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'postName',
    label: '岗位名称',
    component: 'Input',
    colProps: { span: 5 },
    componentProps: {
      placeholder: '请输入名称、成员等',
    },
  },
  {
    field: 'deptName',
    label: '组织部门',
    component: 'Input',
    colProps: { span: 5 },
    componentProps: {
      placeholder: '请输入部门名称',
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'postName',
    label: '岗位名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'postCode',
    label: '岗位编码',
    required: true,
    component: 'Input',
  },
  {
    field: 'postLevel',
    label: '岗位级别',
    component: 'ApiSelect',
    componentProps: {
      allowClear: false,
      api: getDictTypeListApi,
      labelField: 'label',
      valueField: 'intValue',
      params: {
        type: DICT.POST_LEVEL,
      },
      getPopupContainer: () => document.body,
    },
  },
  {
    label: '排序',
    field: 'postSort',
    component: 'InputNumber',
  },
  {
    label: '岗位描述',
    field: 'remark',
    component: 'InputTextArea',
  },
];
